package org.yangspring;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.HandlerExecutionChain;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.HandlerMapping;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.annotation.HandlesTypes;

/**
 * Created by whyang on 2017/06/08.
 */

//@HandlesTypes(WebApplicationInitializer.class)
public class FrankieContextLoaderListener extends ContextLoaderListener {

    private static final Log logger = LogFactory.getLog(FrankieContextLoaderListener.class);

    //
    public void contextInitialized(ServletContextEvent event) {

        whyangSpringContext whyangSC = new whyangSpringContext();

        super.contextInitialized(event);
        whyangSC.setApplicationContext(
                WebApplicationContextUtils.getWebApplicationContext(event.getServletContext())
        );

        ApplicationContextAware acAwr;
        BeanFactory beanFac;
        BeanNameAware beanNameAwr;



        HandlerMapping hdlMapping;
        HandlerExecutionChain hdlExecChain;
        HandlerInterceptor hdlIntcptr;


        ContextLoaderListener cntxLdrLsnr;

        ServletContext svltCntx;

        DispatcherServlet disptSvlt;

        WebApplicationContext wac;


    }
}
